import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ReduceInfoVO, ReduceInfoForm, ReduceInfoQuery } from '@/api/farm/reduceInfo/types';

/**
 * 查询减少记录列表
 * @param query
 * @returns {*}
 */

export const listReduceInfo = (query?: ReduceInfoQuery): AxiosPromise<ReduceInfoVO[]> => {
  return request({
    url: '/farm/reduceInfo/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询减少记录详细
 * @param id
 */
export const getReduceInfo = (id: string | number): AxiosPromise<ReduceInfoVO> => {
  return request({
    url: '/farm/reduceInfo/' + id,
    method: 'get'
  });
};

/**
 * 新增减少记录
 * @param data
 */
export const addReduceInfo = (data: ReduceInfoForm) => {
  return request({
    url: '/farm/reduceInfo',
    method: 'post',
    data: data
  });
};

/**
 * 修改减少记录
 * @param data
 */
export const updateReduceInfo = (data: ReduceInfoForm) => {
  return request({
    url: '/farm/reduceInfo',
    method: 'put',
    data: data
  });
};

/**
 * 删除减少记录
 * @param id
 */
export const delReduceInfo = (id: string | number | Array<string | number>) => {
  return request({
    url: '/farm/reduceInfo/' + id,
    method: 'delete'
  });
};
